import http from '@/utils/httpRequest'
import ApiUrl from '@/constant/api-url'

let config = {
  headers: {
    'Content-Type': 'multipart/form-data;charset=utf-8'
  },
  transformRequest: [function (data) {
    return data
  }]
}

const flashDataApi = {
  /**
   * 获取所有假数据
   */
  queryAll: function () {
    return http({
      baseURL: ApiUrl.API_HOST_BASE,
      url: http.adornUrl('api/flashdata/query-all'),
      method: 'post',
    })
  },

  /**
   * 新增信息
   */
  add: function (data) {
    return http({
      url: http.adornUrl('api/flashdata/save'),
      method: 'post',
      data: http.adornData(data)
    })
  },

  /**
   * 根据id查询
   */
  queryById: function (data) {
    return http({
      url: http.adornUrl('api/flashdata/query-by-id'),
      method: 'post',
      data: http.adornData(data)
    })
  },

  /**
   * 打开文件
   */
  openTxt: function () {
    return http({
      baseURL: ApiUrl.API_HOST_BASE,
      url: http.adornUrl('api/flashdata/open-txt'),
      method: 'post',
    })
  }

}

export default flashDataApi